package com.etalk.crm.controller.newmain;

import com.alibaba.fastjson.JSONObject;
import com.etalk.crm.pojo.Lessons;
import com.etalk.crm.pojo.NewMainBean;
import com.etalk.crm.pojo.PersonFeedback;
import com.etalk.crm.pojo.SurplusAutoOrderMap;
import com.etalk.crm.service.CCNewMainService;
import com.etalk.crm.service.SSCNewMainService;
import com.github.pagehelper.PageInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

import static com.etalk.crm.utils.PubResult.pubResultFunction;

/**
 * @Auther: James
 * @Date: 2018/12/28 16:06
 * @Description: 学习服务顾问ssc首页工作台
 */
@Controller
@RequestMapping(value = "/SSCNewMain", produces = "application/json; charset=utf-8")
public class SSCNewMainManageCtl {
    protected static final Logger logger = LogManager.getLogger(SSCNewMainManageCtl.class);

    @Resource
    private CCNewMainService ccNewMainService;

    @Resource
    private SSCNewMainService sscNewMainService;

    /**
     * 首页ssc 提醒列表
     *
     * @param page
     * @param limit
     * @param searchDate
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectTrackRemindBySsc", method = RequestMethod.POST)
    @ResponseBody
    public String selectTrackRemindBySsc(Integer sscId, Integer page, Integer limit, String searchDate, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = ccNewMainService.selectTrackRemindByUserId(null, searchDate, sscId, null, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页SSC提醒列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 根据cc ssc 查询关联学生订单的60天到期信息或课时剩30以下
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/searchStuOrderInfoBySSC", method = RequestMethod.POST)
    @ResponseBody
    public String searchStuOrderInfoBySSC(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = ccNewMainService.searchStuOrderInfoByCC(0, sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页SSC学生订单的60天到期信息或课时剩30以下列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 教材将学完列表
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectMaterialFinishedBySSC", method = RequestMethod.POST)
    @ResponseBody
    public String selectMaterialFinishedBySSC(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectMaterialFinishedBySSC(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页教材将学完列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 新学员oc课程跟踪
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectOcNewStudent", method = RequestMethod.POST)
    @ResponseBody
    public String selectOcNewStudent(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectOcNewStudent(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页新学员oc课程跟踪列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }


    /**
     * @Author James
     * @Description 老学员跟进
     * @Date 15:20 2019/1/10
     * @Param
     * @return
     **/
    @RequestMapping(value = "/oldStuFollow", method = RequestMethod.POST)
    @ResponseBody
    public String oldStuFollow(Integer sscId,Integer followDays, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectOcOldStudent(sscId,followDays, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页老学员跟进列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 学生旷课或者取消上课记录(首页未正常完成课程学员面板)
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/abnormalunFinishLessons", method = RequestMethod.POST)
    @ResponseBody
    public String selectLessonState(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectLessonState(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页未正常完成课程学员列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 未约  课记录
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectInactiveLessons", method = RequestMethod.POST)
    @ResponseBody
    public String selectInactiveLessons(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectInactiveLessons(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页未约课记录表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 老师投诉学员列表
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectTeacherRank", method = RequestMethod.POST)
    @ResponseBody
    public String selectTeacherRank(Integer sscId,String searchKey, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.selectTeacherRank(sscId,searchKey, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页老师投诉学员列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 学员投诉老师 列表
     *
     * @param page
     * @param limit
     * @param session
     * @return
     */
    @RequestMapping(value = "/selectstuEvaluationList", method = RequestMethod.POST)
    @ResponseBody
    public String selectEvaluationList(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchFeedbackInfoByPage(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页学员投诉老师列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }


    /**
     * @Author James
     * @Description 添加 老师投诉学员 回复
     * @Date 17:02 2019/1/11
     * @Param
     * @return
     **/
    @RequestMapping(value = "addTeacherRankReply", method = RequestMethod.POST)
    @ResponseBody
    public String addTeacherRankReply(HttpSession session, int lessonId, String reply) {
        logger.info("添加回复（老师投诉学员）并同步动态");
        String userName = session.getAttribute("loginname").toString();
        int addUserId = Integer.parseInt(session.getAttribute("userid").toString());
        int flag = sscNewMainService.addTeacherRankReply(lessonId, reply, userName, addUserId);
        Map<String, Object> jsonMap = new HashMap<String, Object>();
        if (flag > 0) {
            logger.info("添加回复（老师投诉学员）成功");
            jsonMap.put("code", 1);
        } else {
            logger.info("添加回复（老师投诉学员）失败");
            jsonMap.put("code", -1);
        }
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 添加 学员投诉老师 回复
     *
     * @param session
     * @return
     */
    @RequestMapping(value = "/addFeedbackResult", method = RequestMethod.POST)
    @ResponseBody
    public String addFeedbackResult(HttpSession session, String feedBack, String personFeedbackId) {
        logger.info("添加回复（学员投诉老师）并同步动态");
        PersonFeedback feedback = new PersonFeedback();
        feedback.setResultUser(session.getAttribute("loginname").toString());//添加处理人
        feedback.setFeedbackType("建议");
        feedback.setId(personFeedbackId);
        feedback.setFeedbackResult(feedBack);
        feedback.setPersonId(Integer.parseInt(session.getAttribute("userid").toString()));
        //添加回复（学员投诉老师）并同步动态
        int flag = sscNewMainService.addFeedbackResult(feedback);
        Map<String, Object> jsonMap = new HashMap<String, Object>();
        if (flag > 0) {
            jsonMap.put("code", 0);
            jsonMap.put("msg", "回复复成功");
            logger.info("添加回复（学员投诉老师）并同步动态成功");
        } else {
            jsonMap.put("code", -1);
            jsonMap.put("msg", "回复失败");
            logger.info("添加回复（学员投诉老师）并同步动态失败");
        }
        return JSONObject.toJSONString(jsonMap);
    }


    /**
     * @Author James
     * @Description 查询学员投诉老师 那节课基本信息
     * @Date 10:33 2019/1/14
     * @Param
     * @return
     **/
    @RequestMapping(value = "/selectLessonInfoById", method = RequestMethod.POST)
    @ResponseBody
    public String selectLessonInfoById(int lessonId) {
        logger.info("查询学员投诉老师课程基本信息");
        Lessons lessons = sscNewMainService.selectLessonInfoById(lessonId);
        Map<String, Object> jsonMap = new HashMap();
        jsonMap.put("lessons", lessons);
        jsonMap.put("code", 1);
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * @Author James
     * @Description voidList
     * @Date 14:30 2019/1/14
     * @Param
     * @return
     **/
    @RequestMapping(value = "/showVoidReasonList", method = RequestMethod.POST)
    @ResponseBody
    public String showVoidReasonList(int lessonId) {
        logger.info("查看异常课程信息");
        Map<String, Object> jsonMap = new HashMap<>(2);
        jsonMap.put("data", sscNewMainService.searcherVoidReasonList(lessonId));
        jsonMap.put("code", 1);
        return JSONObject.toJSONString(jsonMap);
    }


    /**
     * @Author James
     * @Description  添加课程异常原因
     * @Date 16:04 2019/1/15
     * @Param
     * @return
     **/
    @RequestMapping(value = "/addVoidReason", method = RequestMethod.POST)
    @ResponseBody
    public String addVoidReason(HttpSession session, @RequestBody JSONObject jsonObject) {
        logger.info("添加课程异常原因");
        int flag = sscNewMainService.addVoidReason(jsonObject, session.getAttribute("loginname").toString(),
                Integer.parseInt(session.getAttribute("userid").toString()));
        Map<String, Object> jsonMap = new HashMap();
        if (flag > 0) {
            jsonMap.put("code", 1);
        } else {
            jsonMap.put("code", -1);
        }
        return JSONObject.toJSONString(jsonMap);
    }


    /*
     * @Author James
     * @Description 订单续费列表
     * @Date 16:43 2019/3/5
     * @Param
     * @return
     **/
    @RequestMapping(value = "/renewOrders", method = RequestMethod.POST)
    @ResponseBody
    public String renewOrders(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.renewOrders(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页订单续费列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /*
     * @Author James
     * @Description 离职老师常用学员
     * @Date 16:43 2019/3/5
     * @Param
     * @return
     **/
    @RequestMapping(value = "/leaveTeacherStu", method = RequestMethod.POST)
    @ResponseBody
    public String leaveTeacherStu(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.leaveTeacherStu(sscId, page, limit);

        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("离职老师常用学员列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * @Author James
     * @Description 修改订单续费状态
     * @Date 17:25 2019/3/5
     * @Param
     * @return
     **/
    @RequestMapping(value = "/updateRenewOrdersfinish", method = RequestMethod.POST)
    @ResponseBody
    public String updateRenewOrdersfinish(String orderId) {
        Map<String, Object> jsonMap = new HashMap();
        int result = sscNewMainService.updateRenewOrdersfinish(orderId);
        if (result > 0) {
            logger.info("首页修改订单续费状态成功");
            jsonMap.put("code", 1);
        } else {
            logger.info("首页修改订单续费状态失败");
            jsonMap.put("code", 0);
        }
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 上完OC课的学生列表
     * Terwer
     *
     * @param sscId   sscId
     * @param page    页码
     * @param limit   每页
     * @param session session
     * @return 结果列表
     */
    @RequestMapping(value = "/ocInfo", method = RequestMethod.POST)
    @ResponseBody
    public String ocInfo(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.ocInfo(sscId, page, limit);

        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("上完OC课的学生列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 查询钻石学员跟进名单
     * @param sscId 学习顾问id
     * @param page 页码
     * @param limit 页记录数
     * @param session 请求数据
     * @return
     */
    @RequestMapping(value = "/follow/diamond", method = RequestMethod.POST)
    @ResponseBody
    public String getDiamondFollow(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchDiamondStudentFollowList(sscId, page, limit);

        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 待批改试卷
     * @param sscId ssc id
     * @param page 页码
     * @param limit 页记录数
     * @param session session
     * @return
     */
    @RequestMapping(value = "/corrected/test/paper/list", method = RequestMethod.POST)
    @ResponseBody
    public String getCorrectedTestPaperList(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchCorrectedTestPaperList(sscId, page, limit);

        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 待约中教课
     * @param sscId ssc id
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话
     * @return
     */
    @RequestMapping(value = "/chinese/course/not/booked", method = RequestMethod.POST)
    @ResponseBody
    public String getNotBookedChineseCourseList(Integer sscId, Integer revisitId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchNotBookedChineseCourseList(sscId,revisitId, page, limit);
        logger.info("首页ssc待约中教课列表加载成功");
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 待提交阶段检测报告
     * @param sscId ssc id
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话
     * @return
     */
    @RequestMapping(value = "/chinese/not/feedback", method = RequestMethod.POST)
    @ResponseBody
    public String getLtNotFeedbackList(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchLtNotFeedbackList(sscId, page, limit);
        logger.info("首页ssc待提交阶段检测报告列表加载成功");
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 查询自动约课失败记录
     * @param sscId ssc id
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话信息
     * @return
     */
    @RequestMapping(value = "/auto/booked/fail/list", method = RequestMethod.POST)
    @ResponseBody
    public String getAutoBookedFailList(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchAutoBookedFailList(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页ssc自动约课失败列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    @RequestMapping(value = "/modify/auto/booked/fail/state/{id}", method = RequestMethod.POST)
    @ResponseBody
    public String setAutoBookedFailStatus(@PathVariable("id")Integer id, HttpSession session) {

        int num = sscNewMainService.modifyAutoBookedFailState(id);
        Map<String, Object> jsonMap = new HashMap<>(1);
        jsonMap.put("status",num);

        logger.info("首页ssc自动约课失败列表记录完成处理");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 学员上课表现三星以下记录
     * @param sscId ssc id
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话对象
     * @return
     */
    @RequestMapping(value = "/class/attitude/list", method = RequestMethod.POST)
    @ResponseBody
    public String getClassAttitudeList(Integer sscId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchClassAttitudeList(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页ssc学员上课表现三星以下记录列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * 学员上周、本周、下周课程数少于3节记录
     * @param sscId ssc id
     * @param weekId 上周(-1),本周(0),下周(1)
     * @param ltId 学管师学员查询：1学管师，2非学管师
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话对象
     * @return
     */
    @RequestMapping(value = "/class/week/info/list", method = RequestMethod.POST)
    @ResponseBody
    public String getWeekClassInfoList(Integer sscId,Integer weekId,Integer ltId, Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchWeekClassInfoList(sscId,weekId,ltId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页ssc学员上周、本周、下周课程数少于3节记录列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    @RequestMapping(value = "/auto/surplus/order/list", method = RequestMethod.POST)
    @ResponseBody
    public String getSurplusAutoOrderList(Integer sscId,Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<SurplusAutoOrderMap> pageInfo = sscNewMainService.searchSurplusAutoOrderList(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页ssc学员不满足下次自动约课订单记录列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }

    /**
     * cc名下学员最近两次成绩
     * @param sscId ssc id
     * @param searchKey 查询关键字
     * @param page 页码
     * @param limit 页记录数
     * @param session 会话对象
     * @return
     */
    @RequestMapping(value = "/last/two/score/list", method = RequestMethod.POST)
    @ResponseBody
    public String getLastTwoScoreList(Integer sscId,String searchKey,Integer page, Integer limit, HttpSession session) {
        if (page == null) {
            page = 1;
        }
        if (limit == null) {
            limit = 10;
        }
        if (sscId == null) {
            sscId = Integer.parseInt(session.getAttribute("userid").toString());
        }
        PageInfo<NewMainBean> pageInfo = sscNewMainService.searchLastTwoScoreList(sscId, page, limit);
        Map<String, Object> jsonMap = pubResultFunction(pageInfo);
        logger.info("首页ssc名下学员最近两次成绩记录列表加载成功");
        return JSONObject.toJSONString(jsonMap);
    }
}
